package com.crayon.utils
{
	import flash.net.SharedObject;
	
	public class LocalStorage
	{
		private var localCache:SharedObject;
		private static var install:LocalStorage;
		
		public static function getInstall():LocalStorage
		{
			if (install == null)
				install = new LocalStorage("__cache_key__");
			return install;
		}
		
		public function LocalStorage(key:String)
		{
			this.localCache = SharedObject.getLocal(key);
		}
		
		public function set(key:String, value:Object):void
		{
			this.localCache.data[key] = value;
		}
		
		public function get(key:String):Object
		{
			return this.localCache.data[key];
		}
		
		public function getBool(key:String):Boolean
		{
			return Boolean(this.localCache.data[key]);
		}
	}
}